home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / psion / word.fmt < prev    next >
Text File  |  1995-03-31  |  9KB  |  196 lines

  1. PSIONICS FILE - WORD.FMT
  2. ========================
  3. Format of Word files
  4. Last modified 1994-03-28
  5. ========================
  6.  
  7. A word file begins with a header of the following form:
  8.   Offset  0 (cstr): "PSIONWPDATAFILE"
  9.   Offset 16 (word): format version number
  10.   Offset 18 (word): unknown, 0 if not encrypted, 1 if encrypted
  11.   Offset 20 to  28: unknown, presumably encrypted magic value
  12.   Offset 29 to  35: copy of offset 20 to 26
  13.   Offset 36 (word): $EAEA if not encrypted, zero if encrypted
  14.   Offset 38 (word): unused
  15.  
  16. The format version number is 1 for non-passworded files and 256 for passworded
  17. files. @Offset 18 is probably an encryption algorithm version number. Apart
  18. from the header, encryption affects only the data of record type 8 (see
  19. below).@
  20.  
  21. The rest of the file consists of records. All records have the form:
  22.   Offset  0 (word): record type
  23.   Offset  2 (word): size of data portion (L)
  24.   Offset  4 to L+3: data portion
  25.  
  26. Word files have record types 1 to 9; the word processor application creates
  27. them in numerical order of type. Exactly one record of each type is used,
  28. except that there may be more than one record of types 6 and 7.
  29.  
  30. All distances and font sizes are in units of 0.05 points (i.e. a value of
  31. 1440 represents one inch). All font names are represented by standard code
  32. numbers:
  33.     -1 = Inherited (where permitted)
  34.      0 = Courier              17 = Emperor              40 = Greek
  35.      1 = Pica                 18 = Madeleine            41 = Kana
  36.      2 = Elite                19 = Zapf Humanist        42 = Hebrew
  37.      3 = Prestige             20 = Classic              44 = Russian
  38.      4 = Letter Gothic        24 = Times Roman          48 = Narrator
  39.      5 = Gothic               25 = Century              49 = Emphasis
  40.      6 = Cubic                26 = Palatino             50 = Zapf Chancery
  41.      7 = Lineprinter          27 = Souvenir             52 = Old English
  42.      8 = Helvetica            28 = Garamond             55 = Cooper Black
  43.      9 = Avant Garde          29 = Caledonia            56 = Symbol
  44.     10 = Spartan              30 = Bodoni               57 = Line Draw
  45.     11 = Metro                31 = University           58 = Math 7
  46.     12 = Presentation         32 = Script               59 = Math 8
  47.     13 = APL                  33 = Script PS            60 = Dingbats
  48.     14 = OCR A                36 = Commercial Script    61 = EAN
  49.     15 = OCR B                37 = Park Avenue          62 = PC Line
  50.     16 = Standard Roman       38 = Coronet
  51.  
  52. Record type 1 holds information about the file. It is always 10 bytes:
  53.   Offset  0 (word): cursor position within text record (type 8)
  54.   Offset  2 (byte): each set bit indicates a character type should be shown
  55.                     as symbols:
  56.     Bit 0: tabs
  57.     Bit 1: spaces
  58.     Bit 2: carriage returns
  59.     Bit 3: soft hyphens
  60.     Bit 4: forced line breaks
  61.   Offset  3 (byte): (Series 3a only)
  62.     Bits 0 to 1: status window: 0=none, 1=narrow, 2=wide
  63.     Bits 4 to 5: zoom state: 0=smallest, ... 3=largest
  64.   Offset  4 (byte): 0=style bar off, 1=style bar on
  65.   Offset  5 (byte): 0=file type is paragraph, 1=file type is line
  66.   Offset  6 (byte): outlining level
  67.   Offset  7 (byte): unused
  68.   Offset  8 (word): unused
  69.  
  70. Record type 2 holds information about printer set-up. It is
  71. always 58 bytes:
  72.   Offset  0 (word): page width
  73.   Offset  2 (word): page height
  74.     (Note: the above fields assume that the paper orientation is "portrait")
  75.   Offset  4 (word): left margin
  76.   Offset  6 (word): top margin
  77.   Offset  8 (word): width of printing area
  78.   Offset 10 (word): height of printing area
  79.     (Note: these four fields have only been checked for portrait)
  80.   Offset 12 (word): header offset (bottom of header to top of text)
  81.   Offset 14 (word): footer offset (bottom of footer to bottom of text)
  82.   Offset 16 (word): paper orientation: 0=portrait, 1=landscape
  83.   Offset 18 (word): unknown
  84.   Offset 20 (word): first page to print (1=first page)
  85.   Offset 22 (word): last page to print ($FFFF=end of file)
  86.   Offset 24 (word): header font code number
  87.   Offset 26 (byte): header style
  88.     Bit 0: underline
  89.     Bit 1: bold
  90.     Bit 2: italic
  91.     Bit 3: superscript
  92.     Bit 4: subscript
  93.   Offset 27 (byte): unused
  94.   Offset 28 (word): header font size
  95.   Offset 30 (byte): header alignment:
  96.     0 = left
  97.     1 = right
  98.     2 = centered
  99.     3 = justified
  100.     4 = two column
  101.     5 = three column
  102.   Offset 31 (byte): header on first page: 0=no, 1=yes
  103.   Offset 32 to  39: as 24 to 31, but apply to footer, not header
  104.   Offset 40 (word): page number of first page minus 1
  105.   Offset 42 (word): number of pages
  106.   Offset 44 (word): page number style: 0="1,2,3", 1="I,II,III", 2="i,ii,iii"
  107.   Offset 46 (word): base font code number
  108.   Offset 48 (byte): base style (as offset 26)
  109.   Offset 49 (byte): unused
  110.   Offset 50 (word): base font size
  111.   Offset 52 (byte): paper size code:
  112.     0 = A4        (11906 x 16838)
  113.     1 = Custom
  114.     2 = Executive (10440 x 15120)
  115.     3 = Legal     (12240 x 20160)
  116.     4 = Letter    (12240 x 15840)
  117.     5 = Monarch   ( 5580 x 10800)
  118.     6 = DL        ( 6236 x 12472)
  119.   Offset 53 (byte): widows/orphans allowed: 0=no, 1=yes
  120.   Offset 54 (long): unused
  121. The base font code, style, and font size are unused by Word (and should be set
  122. to code 0, style 0, size 240). Other applications using this record layout may
  123. use them and provide means to set them.
  124.  
  125. Record type 3 holds information about the printer driver:
  126.   Offset  0 (byte): printer driver model number
  127.   Offset  1 (cstr): printer driver library
  128. A printer driver library can support several similar printers; the model number
  129. specifies which is selected.
  130.  
  131. Record types 4 and 5 hold cstrs giving the header and footer text respectively.
  132.  
  133. Record types 6 and 7 have a similar layout. Record type 6 describes a style
  134. and uses all 80 bytes. Record type 7 describes an emphasis and uses only the
  135. first 28 bytes.
  136.   Offset  0 to   1: short code, as uppercase letters
  137.   Offset  2 (cstr): full name
  138.   Offset 18 (byte):
  139.     Bit 0: 0=style, 1=emphasis
  140.     Bit 1: set if style or emphasis undeletable
  141.     Bit 2: set for default style or emphasis
  142.   Offset 19 (byte): unused
  143.   Offset 20 (word): font code number (can be inherited)
  144.   Offset 22 (byte): style (bits inherited must be clear in this byte)
  145.     Bit 0: underline
  146.     Bit 1: bold
  147.     Bit 2: italic
  148.     Bit 3: superscript (available in emphasis only)
  149.     Bit 4: subscript   (available in emphasis only)
  150.   Offset 23 (byte): unused
  151.   Offset 24 (word): font size
  152.   Offset 26 (byte):
  153.     Bit 0: inherit underline setting
  154.     Bit 1: inherit bold setting
  155.     Bit 2: inherit italic setting
  156.     Bit 3: inherit superscript setting (available in emphasis only)
  157.     Bit 4: inherit subscript setting   (available in emphasis only)
  158.   Offset 27 (byte): unused
  159.   Offset 28 (word): left indent
  160.   Offset 30 (word): right indent
  161.   Offset 32 (word): first line indent
  162.   Offset 34 (word): alignment: 0=left, 1=right, 2=centred, 3=justified
  163.   Offset 36 (word): line spacing
  164.   Offset 38 (word): space above paragraph
  165.   Offset 40 (word): space below paragraph
  166.   Offset 42 (byte): spacing controls:
  167.     Bit 0: set to keep with next
  168.     Bit 1: set to keep together
  169.     Bit 2: set to start new page
  170.   Offset 43 (byte): unused
  171.   Offset 44 (word): Outline level (1 to 9)
  172.   Offset 46 (word): number of tab stops set
  173.   Offset 48 (word): position of first tab stop
  174.   Offset 50 (word): type of first tab stop: 0=left, 1=right, 2=centred
  175.   Offset 52 to  55: as offsets 48 to 51 for second tab stop
  176.   Offset 56 to  79: as offsets 48 to 51 for third to eighth tab stops
  177.  
  178. Record type 8 holds the actual text. The following bytes have special
  179. meanings:
  180.    0 = paragraph separator
  181.    7 = unbreakable hyphen
  182.   14 = soft hyphen (displayed only if used to break line)
  183.   15 = unbreakable space
  184.  
  185. Record type 9 consists of a sequence of blocks giving the style and emphasis
  186. for the text; each block covers some number of consecutive bytes, and the
  187. blocks between them cover the entire text. No block crosses a paragraph
  188. boundary, but the last block of the paragraph includes the zero byte separating
  189. it from the next paragraph. Each block is 6 bytes:
  190.   Offset  0 (word): number of bytes covered
  191.   Offset  2 to   3: shortcode of style applied
  192.   Offset  4 to   5: shortcode of emphasis applied
  193. The last block should cover an extra byte (an imaginary extra zero separator),
  194. so that the sum of the bytes covered is one more than the size of the type 8
  195. record.
  196.